package com.easy.common.enumbean;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;

public enum ContactType {
    MOBILE("手机"),
    WORK_PHONE("工作电话"),
    FAX("传真"),
    WECHAT("微信"),
    OTHER("其他");

    @EnumValue
    private final String value;

    private ContactType(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    @Override
    public String toString() {
        return this.value;
    }

    @JsonCreator
    public static ContactType fromValue(String value) {
        for (ContactType contactType : values()) {
            if (contactType.getValue().equals(value)) {
                return contactType;
            }
        }
        throw new IllegalArgumentException("No matching Gender enum found for value: " + value);
    }
}